package AM;

public class CatchHeroin_TurnCheck extends Thread {
	
	CatchHeroin_Client cc;
	
	public CatchHeroin_TurnCheck(CatchHeroin_Client cc) {
		
		this.cc = cc;
	}
	
	/**
	 * 시간 진행
	 * @return : 턴 변경을 위해 false 값을 반환 한다.
	 */

	@Override
	public void run() {
		try {
			
			for (int i = 1; i <= 60; i++) {
				sleep(1000);
				cc.pg.setValue(i);
				cc.status.setText(i + "/60 sec");

			}
			
			cc.isGaming = false;
			System.out.println("turn name:: " + cc.nickName );
			System.out.println("isturn :: " + cc.isTurn);
			if(cc.isTurn){
				Protocol p = new Protocol();
				p.setCmd(Protocol.GAME_END);
				cc.out.writeObject(p);
			}
			
			

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
